from sqlalchemy import create_engine, Column, Boolean
from sqlalchemy.ext.declarative import declarative_base
from alembic import op
import sqlalchemy as sa

def upgrade():
    # 使用 alembic 添加新列
    op.add_column('knowledge_contents', sa.Column('is_complete', sa.Boolean(), nullable=True))
    
    # 更新现有记录
    op.execute('UPDATE knowledge_contents SET is_complete = false')

def downgrade():
    op.drop_column('knowledge_contents', 'is_complete') 